// 兼容 IE
// https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#babelpolyfill
import 'core-js/stable'
import 'regenerator-runtime/runtime'

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import '@/permission.js'
import Vconsole from 'vconsole'
// new Vconsole()
// 引入全局样式
import '@/assets/css/index.scss'
// 设置 js中可以访问 $cdn
import {$cdn} from '@/config'
Vue.prototype.$cdn = $cdn

// 全局引入按需引入UI库 vant
import '@/plugins/vant'
import {
  Empty,
  NoticeBar,
  List,
  Swipe,
  SwipeItem,
  Collapse,
  CollapseItem,
  DropdownMenu,
  DropdownItem,
  Divider,
  Checkbox,
  CheckboxGroup,
  Button,
  Tab,
  PullRefresh,
  Tabs,
  NavBar,
  Tag,
  Cell,
  CellGroup,
  Form,
  Field,
  ImagePreview,
  Toast,
  Image as VanImage
} from 'vant'
Vue.use(Toast)
Vue.use(ImagePreview)
Vue.use(Field)
Vue.use(VanImage)
Vue.use(List)
Vue.use(PullRefresh)
Vue.use(NoticeBar)
Vue.use(Empty)
Vue.use(CellGroup)
Vue.use(Cell)
Vue.use(Collapse)
Vue.use(CollapseItem)
Vue.use(Swipe)
Vue.use(SwipeItem)
Vue.use(DropdownMenu)
Vue.use(DropdownItem)
Vue.use(Divider)
Vue.use(Checkbox)
Vue.use(CheckboxGroup)
Vue.use(Button)
Vue.use(Tab)
Vue.use(Tabs)
Vue.use(NavBar)
Vue.use(Tag)
Vue.use(Form)
// 移动端适配
import 'lib-flexible/flexible.js'

// filters
import './filters'
Vue.config.productionTip = false
// router.beforeEach((to, from, next) => {
//   console.log('wwww', router)
//   /**
//    * 缓存记录页面初始（即授权前）路径
//    * 主要用于解决在页面手动刷新时，微信授权问题
//    * hash模式：let href = window.location.origin + window.location.pathname + '#' + to.fullPath
//    * location：let href = window.location.origin + window.location.pathname + to.fullPath
//    */
//   let href = window.location.origin + window.location.pathname + '#' + to.fullPath
//   window.localStorage.setItem('WXAuthorizeUrl', href)

//   next()
// })
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
